\chapter{CLUBs The "CLUBs language for universal board games"}
\label{chapter::DesignDecisions}
In the following chapter we will disguise some of the functional and visual chooses we made for the CLUBs laungage, and why we made this decisions.

\subsection{Function and class declaration}

The laungage doesn’t support class directly. But support the ability to declare board, piece etc. in the global scope. These types with predefined properties are used like classes in the sense that they used to describe an object contained in a board game.

Function in also declared in the global scope. But doesn’t contain predefined properties and doesn’t describe an object. In our programming laungage it is used to describe an automated event or any form of calculation that requires some input. For most new comers to this laungage it would most likely be case one, automated events. Therefore we decided on naming functions $action$.

\subsection{Curly bracket versus begin/end}
There are too common ways for declaring a block in programming languages. With $\{$ as a marker for the beginning of a new block, and $\}$ marking the ending of a block. The other way is using $begin$ as $\{$ and $end$ as $\}$. To the best of our knowledge curly bracket is the most commonly used. We went with curly bracket not only because it is commonly used, but it also provide better writability in our opinion. One could argue that $begin$ and $end$ is more readable because it used word rather than special characters, but if you compare them to.
\begin{lstlisting}
begin game 

	begin cell MainCell 
		MaxPieces = 1;
	end
	
end
\end{lstlisting}
\begin{lstlisting}
game 
{
	cell MainCell
	{	
		MaxPieces = 1;
	}
}
\end{lstlisting}
It becomes clear that, yes begin game does provide some readability, but curly bracket provides an easier overview and a more clear structure.


\subsection{Return types and function input}

In the way we wrote our code example\ref{TTT:example} the actions is our languages functions. It is necessary for the actions to have a return type, and to be able to take some input. In traditional programming it is often 
\begin{lstlisting}
return_type function name_of_funktion(input1...input_n)
\end{lstlisting}
which is fairly easy to understand for your average programmer? But because we aim this laungage at persons who don’t have a lot programming experience we have taken a more sentence like approve. If you declare an action and want it to return something. You add 
\begin{lstlisting}
gives type
\end{lstlisting}
after the name. This declares the return type. If you want to define want kind of input the function should take, you write 
\begin{lstlisting}
takes input_type_1 input_1 ... input_type_n input_n
\end{lstlisting}






\subsection{Block Structure}
\label{block}
If we look at the code example\ref{TTT:example} of what we would like a game in our laungage to look like, a few things come to mind.
The block structure resembles a flat block structure, because our program can be dividing into several disjoint blocks. However this is not the block structure we settled on. Because we would like to support nested loops. In the definition of nested block structure we find that one of the conditions for a structure to be a nested block structure is: "Declarations inside an inner block are local to that block. Every inner block is completely enclosed by another block. If enclosed by the outermost block..."\footnote{Watt and Brown page 142}.

This fit our idea of a generic board game laungage even better. This makes it possible for e.g. a board to contain a piece, because a piece would be in the global scope. Yet we can have variables within board with the same name as a variable in piece. 


One of the things we would like our laungage to support is the ability to declare board and pieces in a "random" order. Which fit our description of and end user well because they could have board and piece in a !!!random!!! order and the program would still function. Unlike $C$ they would have to think about declaring actions before using them.


\subsection{Accessing function out of own scope}
It is possible in our laungage it accessing function that are not declared inside the current scope. An example of then this is used is in example ??. If you look at line ?? we use the the $action$ ThreeInARow which is located in the library LineFunctions. To do this use write the name of the library followed by $->$ an the functions identifier. 



\subsection{Interpreter}


% but ?? ud med TTT example refrences.
%tilføje Programming language processors in java til literatur listen


